All Questions
542 questions
0votes
0answers
67views
inserting colored properties into files
when it comes to the echo -e command, of course you can do a lot with it when it comes to printing color text, especially when it comes to making terminal based UIs, but I have one main question, does ...
1vote
2answers
77views
How to loop over a list of extensions to check that files of each type exist?
I have the following directory structure: main_dir/ │ ├── randstr1.randstr2.tar.gz │ ├── randstr3.randstr4.tar.gz │ ├── randstr5.randstr6.tar.gz │ ├── randstr7.ext2 │ └── randstr8.ext3 ...
0votes
3answers
83views
recursively find all directories *primarily* occupied with images
I'm working on a very unorganized archive of a friend spanning many years and with a lot of duplication and compicated structure. I want to split the archive into directories that are primarily ...
0votes
3answers
231views
Append N hexadecimal numbers to a binary file with Bash
I have a Bash script that appends bytes written as hexadecimal values. I use echo to write the bytes and it works hex="1F" byte="\x$hex" echo -en $byte >> "output.bin&...
0votes
3answers
150views
How to display all existing regular files from a text file using one-liner?
How to display all existing regular file names from a text file? Example: $ cat file.txt zzz xxx/yyy 234 546 "abc def" --bbb $ cat file.txt | <one-liner> zzz xxx/yyy In this list ...
0votes
1answer
140views
Use grep to search stdout, without replacing stdout
At the moment, I have this in a wrapper script: 2>&1 ./update.sh | ts | tee -a ./update.log and this in update.sh: if apt full-upgrade -y | grep linux-headers then echo echo Need to ...
1vote
1answer
38views
Moving and organizing files with find
I have a folder on a Debian GNU/Linux 12 (bookworm) x86_64 Server used as a NAS/Homelab server with a lot of files from a surveillance camera. MDAlarm_20240301-091804.jpg ... MDAlarm_20240316-153813....
0votes
1answer
133views
Access USB device with Bash script
I am using a Raspberry Pi 4 Model B. I am trying to make a script that runs automatically whenever a USB device is plugged in. It will try to read from a text file on the USB device. This is what I ...
0votes
2answers
141views
How to get the cursor back on the last line of a file
I have a `text file with three numbers and each number separated by new line. -55 -56 -64 When I open the file I can see the cursor is on the fourth blank line. I want the cursor to stay on the last ...
-1votes
2answers
129views
Batch rename of files that share the same prefix
I have a list of files on my server with a prefix that I want to de-dupe. These are completely different generated files. It seems to be generated files with {Title} - {yyyy-MM-dd}_{random} - {...
3votes
4answers
599views
Copy an evenly spaced subset of files
For example I have files : file0.txt file1.txt file2.txt .... file100.txt I would like to copy 5 files in bash, which will produce result : file0.txt file19.txt file39.txt file59.txt file79.txt Edit....
1vote
2answers
212views
Redirect to a filename that will be a variable and contain a command substitution
I'm using nmap to scan a network and then create an XML file that contains the scanned information. I want that XML file to contain the date of the scan so that each file is unique and I can see the ...
-2votes
1answer
72views
unable to evaluate line from file as input aithmetically
So I am writing a bash script that takes in a file with integers on each line and I am writing a function that converts those integers in each line into roman numerals, which i will need to write into ...
0votes
1answer
76views
Can't interact with a file with an apostraphe directly in bash
I have a file titled "I'm Here.mp3" when I try to interact with it with ls, cp, mv, anything, it returns cannot stat "./I'm Here.mp3": No such file or directory. I tried double ...
0votes
3answers
855views
Use bash to overwrite old file with a new file named according to current date
I am a complete beginner with linux, and need help making a bash script to create a file with a specific date in the file name. I have a directory called /backups/, in which I would like to create a ...